function DecimalInput(decimalSeparator, decimalPlaces) {
	this.decimalSeparator = decimalSeparator || '.';
    this.decimalPlaces = decimalPlaces !== undefined ? decimalPlaces : 2; 
}

DecimalInput.prototype.nextValidState = function(input) {
    var previousState = input.slice(0, -1);
    var inputedChar = input.slice(-1);
    //caso especial: . será considerado número mesmo se o sep. for diferente
    if(inputedChar === '.' && inputedChar !== this.decimalSeparator) {
    	return previousState;
    }
    if(inputedChar === this.decimalSeparator) {
        return previousState.indexOf(this.decimalSeparator) >= 0 ? previousState : input
    } 
    if(!input.isNumber(this.decimalSeparator)) {
        return previousState
    }
    var inputDecimalPlaces = input.indexOf(this.decimalSeparator) >= 0 ? input.split(this.decimalSeparator)[1].length : 0;


    return inputDecimalPlaces <= this.decimalPlaces ? input : previousState;
}